package com.lidroid.xutils_sample.bean;

import org.junit.Test;

import static org.junit.Assert.*;

public class UserTest {

    private final User user = new User();

    private static final String mStr = "name";

    private static final String mEmail = "123@456.com";

    @Test
    public void getId() {
        user.setId(1);
        int num = user.getId();
        assertEquals(1, num);
    }

    @Test
    public void getName() {
        user.setName(mStr);
        String name = user.getName();
        assertEquals(mStr, name);
    }

    @Test
    public void getEmail() {
        user.setEmail(mEmail);
        String email = user.getEmail();
        assertEquals(email, email);
    }

    @Test
    public void testToString() {
        user.setId(1);
        user.setName(mStr);
        user.setEmail(mEmail);
        String str = user.toString();
        assertEquals(toString(), str);
    }

    public final String toString() {
        return "User{" +
                "id=" + 1 +
                ", name='" + mStr + '\'' +
                ", email='" + UserTest.mEmail + '\'' +
                '}';
    }
}